#include<bits/stdc++.h>
using namespace std;
typedef pair<string,int>pp;
pp div(string &s1,int s2)
{
    string ans1;
    int ans2;
    int count=0;
    for(int i=0;i<s1.size();i++)
    {
        int tem1=s1[i]-'0'+count*10;
        ans1.push_back(tem1/s2+'0');
        count=tem1%s2;
    }
    reverse(ans1.begin(),ans1.end());
    while(ans1.size()>1&&ans1[ans1.size()-1]=='0') ans1.pop_back();
    reverse(ans1.begin(),ans1.end());
    return {ans1,count};
}
int main()
{   
    string s1;int s2;
    cin>>s1>>s2;
    pp ret=div(s1,s2);
    cout<<ret.first<<endl<<ret.second;
    return 0;
}